import { Map } from "immutable";
import { actionTypes } from "./index";

const defaultValue = Map({
    banners: [],
    artistsList: [],
    hotRecommnedList: [],
    // 新歌榜
    hotNewSongList: null,
    // 飙升榜
    hotSoaringList: null,
    // 原创榜
    hotOriginalList: null,
})

function reducer(state = defaultValue, action) {
    switch (action.type) {
        case actionTypes.GET_RECOMMEND_BANNERS:
            return state.set("banners", action.banners);
        case actionTypes.GET_RECOMMEND_SONGS_LIST:
            return state.set("artistsList", action.artistsList);
        case actionTypes.GET_RECOMMEND_HOT:
            return state.set("hotRecommnedList", action.hotRecommnedList);
        case actionTypes.GET_HOT_NEWSONG:
            return state.set("hotNewSongList", action.hotNewSongList);
        case actionTypes.GET_HOT_SOARING:
            return state.set("hotSoaringList", action.hotSoaringList);
        case actionTypes.GET_HOT_ORIGINAL:
            return state.set("hotOriginalList", action.hotOriginalList);
        default:
            return state;
    }
};

export default reducer;